package com.linshengjian.snowball.finance.service;

import com.linshengjian.snowball.core.exception.BusinessException;
import com.linshengjian.snowball.core.exception.SystemErrorException;
import com.linshengjian.snowball.core.page.PageData;
import com.linshengjian.snowball.core.page.PageParam;
import com.linshengjian.snowball.finance.model.Savings;
import com.linshengjian.snowball.finance.model.SavingsRecord;

public interface ISavingsService {

    /**
     * 开户
     * @return
     */
    Savings create() throws SystemErrorException;

    /**
     * 获取账户信息
     * @param id
     * @return
     */
    Savings get(Long id) throws SystemErrorException;

    /**
     * 查询资金记录
     * @param savingsId 储蓄ID
     * @param pageReq 分页
     * @return
     */
    PageData<SavingsRecord> list(Long savingsId, PageParam pageReq) throws SystemErrorException, BusinessException;

    /**
     * 收入
     * @param savingsId 储蓄ID
     * @param amount 金额
     * @param remark 备注
     * @return
     */
    SavingsRecord income(Long savingsId, Double amount, String remark) throws BusinessException, SystemErrorException;

    /**
     * 支出
     * @param savingsId 储蓄ID
     * @param amount 金额
     * @param remark 备注
     * @return
     */
    SavingsRecord expenditure(Long savingsId, Double amount, String remark) throws BusinessException, SystemErrorException;
}
